﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

namespace iMall.AtoZ.Helper
{
    public class DALFactory
    {
        public static IDAL<OrderInfoEnity> GetOrderInfoDAL()
        {
            if (AtoZUtility.DbType == DbAccessType.Access)
            {
                return new OrderInfoDAL();
            }
            else
            {
                return new OrderInfoSqlDAL();
            }
        }

        public static IDAL<LoadTraceEntity> GetLoadTraceDAL()
        {
            if (AtoZUtility.DbType == DbAccessType.Access)
            {
                return new LoadTraceDAL();
            }
            else
            {
                return new LoadTraceSqlDAL();
            }
        }

        public static IDAL<MerchantEntity> GetMerchantDAL()
        {
            if ( AtoZUtility.DbType == DbAccessType.Access )
            {
                return new MerchantDAL();
            }
            else
            {
                return new MerchantDAL();
            }
        }

        public static DataSet ExecuteSQLDataSet(string sql)
        {
            DataSet ds = null;

            if (AtoZUtility.DbType == DbAccessType.Access)
            {
                ds = AccessDALHelper.ExecuteSQLDataSet(sql);
            }
            else
            {
                ds = SqlDALHelper.ExecuteSQLDataSet(sql);
            }

            return ds;
        }
    }
}